package com.brother.goallife.type;

import com.brother.goallife.exception.GoallifeException;

public enum FriendRequestStatusType  {
	
	WAITING_ACCEPTED("WAITI"),
	DENIED("DENIE"),
	ACCEPTED("ACCEP");

	
	private String code;
	
	private FriendRequestStatusType(String code) {
		this.code = code;
	}
	
	public String getCode() {
		return code;
	}
	
	public FriendRequestStatusType getTypeFromCode(String code) throws GoallifeException{
		for (FriendRequestStatusType item : FriendRequestStatusType.values()) {
			if (item.code.equals(code)) {
				return item;
			}
		}
		
		throw new GoallifeException("This enum type is not supprted");
	}
}
